import request from '@/utils/request'

// 查询专区满折活动列表
export function listFullDiscount (query) {
    return request({
        url: '/store/promotion/fullDiscount_zone',
        method: 'get',
        params: query
    })
}
// 新增专区满折活动
export function addFullDiscount (data) {
    return request({
        url: '/store/promotion/fullDiscount_zone',
        method: 'post',
        data: data
    })
}
// 修改专区满折活动
export function updateFullDiscount (data) {
    return request({
        url: '/store/promotion/fullDiscount_zone/',
        method: 'put',
        data: data
    })
}

// 关闭 活动 
export function closeActivity (id) {
    return request({
        url: `/store/promotion/fullDiscount_zone/${id}/close`,
        method: 'delete',
    })
}

// 获取专区满减活动规则列表     /dev-api/store/promotion/fullReduction/{fullReductionId}/rules
export function getGoodsActivityRuleList (fullReductionId) {
    return request({
        url: `/store/promotion/fullDiscount_zone/${fullReductionId}/rules`,
        method: 'get',
    })
}

// 新增专区满减活动规则   /dev-api/store/promotion/fullReduction/{fullReductionId}/rules
export function addGoodsActivityRule (fullReductionId, data) {
    return request({
        url: `/store/promotion/fullDiscount_zone/${fullReductionId}/rules`,
        method: 'post',
        data: data
    })
}

// 修改专区满减活动规则  /dev-api/store/promotion/fullReduction/{fullReductionId}/rules/{id}
export function updGoodsActivityRule (fullReductionId, id, data) {
    return request({
        url: `/store/promotion/fullDiscount_zone/${fullReductionId}/rules/${id}`,
        method: 'put',
        data: data
    })
}
// 删除专区满减活动规则  /dev-api/store/promotion/fullReduction/{fullReductionId}/rules/{id}
export function delGoodsActivityRule (fullReductionId, id) {
    return request({
        url: `/store/promotion/fullDiscount_zone/${fullReductionId}/rules/${id}`,
        method: 'delete',
    })
}